package com.tianhe.common.tongsuo;

import com.baomidou.mybatisplus.autoconfigure.ConfigurationCustomizer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class MyBatisCryptoConfig {

    @Bean
    public CryptoInterceptor cryptoInterceptor() {
        return new CryptoInterceptor();
    }

    @Bean
    public DecryptoInterceptor decryptoInterceptor() {
        return new DecryptoInterceptor();
    }

    @Bean
    public ConfigurationCustomizer mybatisCryptoCustomizer() {
        return configuration -> {
            configuration.addInterceptor(cryptoInterceptor());
            configuration.addInterceptor(decryptoInterceptor());
        };
    }
}
